﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt
{

    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt;

    public class ref_ProjectAndEnterprise_Map : ClassMapping<ref_ProjectAndEnterprise>
    {
        public ref_ProjectAndEnterprise_Map()
        {
            //映射ID
            Id(x => x.pe_id, map => map.Length(40));

            Property(x => x.is_valid);
            Property(x => x.create_date);

            //记录关联的项目
            ManyToOne(x => x.proj, map =>
            {
                map.Column("proj_id");
            });

            //记录关联的投标人
            ManyToOne(x => x.ent, map =>
            {
                map.Column("ent_id");
            });

            Bag(x => x.ProjectBuyRecords, map =>
            {
                map.Key(km => km.Column("pe_id"));
            }, act => act.OneToMany());

            Bag(x => x.ProjectBZJ_Ss, map =>
            {
                map.Key(km => km.Column("pe_id"));
            }, act => act.OneToMany());

            Bag(x => x.ProjectBZJ_Ts, map =>
            {
                map.Key(km => km.Column("pe_id"));
            }, act => act.OneToMany());

            Bag(x => x.ProjectFWF_Ss, map =>
            {
                map.Key(km => km.Column("pe_id"));
            }, act => act.OneToMany());

            Bag(x => x.ProjectEvaluationRecords, map =>
            {
                map.Key(km => km.Column("pe_id"));
            }, act => act.OneToMany());

            Bag(x => x.ProjectBZJ_Tui_SQDetails, map =>
            {
                map.Key(km => km.Column("pe_id"));
            }, act => act.OneToMany());

            Bag(x => x.ProjectBZJ_Tui_SQDetails, map =>
            {
                map.Key(km => km.Column("pe_id"));
            }, act => act.OneToMany());

            Bag(x => x.ProjectFWF_SQDetails, map =>
            {
                map.Key(km => km.Column("pe_id"));
            }, act => act.OneToMany());

            Table("r_project_enterprise");
        }
    }
}
